package com.example.coffeejava.Mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.coffeejava.Dto.PriceDto;
import com.example.coffeejava.Entity.Order;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface OrderMapper extends BaseMapper<Order> {
    Page<Order> getlist(Long id);

    @Select("select SUM(total_price) from orders where shop_id=#{id} and create_time BETWEEN CONCAT(CURDATE(),' 00:00:00') AND CONCAT(CURDATE(),' 23:59:59');")
    Integer getcurcount(Long id);

    Integer getcurtcount(Long id);

    @Select("select SUM(total_price) from orders where shop_id=#{id}")
    Integer gettotalprice(Long id);

    Integer gettotalcount(Long id);

    @Select("select date_format(create_time,'%Y-%m-%d')day, sum(total_price)price from orders where shop_Id=#{id} group by day order by day")
    List<PriceDto> getprice(Long id);
//    @Select("select SUM(num) from orderitem where info_id =#{ids} and order_id in (select order_Id from orders where shop_Id=#{id1})")
    Integer getcount2(@Param("ids") Integer ids,@Param("id1") Long id1);
    @Select("select SUM(total_price) from orders where  create_time BETWEEN CONCAT(CURDATE(),' 00:00:00') AND CONCAT(CURDATE(),' 23:59:59');")
    Integer getcurcount1(Long id);

    Integer getcurtcount1(Long id);
    @Select("select SUM(total_price) from orders ")
    Integer gettotalprice1(Long id);

    Integer gettotalcount1(Long id);
    @Select("select date_format(create_time,'%Y-%m-%d')day, sum(total_price)price from orders   group by day order by day")
    List<PriceDto> getprice1();

    Integer getcount3(Integer ids);

    Page<Order> getlistt(Long id);

//@Select("select  sum(num) from orderitem where info_id =#{id} and order_id in (select order_Id from orders where shop_Id=#{id1}) ")
//    Integer getcount(Long id, Long id1);
}
